home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Windows Selection / Windows Selection 1.iso / Graphics / Formula Graphics Multimedia System / GAME_2.SXT < prev    next >
Encoding:
Text File  |  1996-05-15  |  1.4 KB  |  66 lines

  1. //////////////////////////
  2. // Harrow Software 1996
  3. // Good guy definition
  4. //
  5.  
  6. message "Please execute game_1.sxt"
  7. return
  8.  
  9. /////////////////////
  10. initialize: bitmaps
  11.     my_sprite = new sprite
  12.     $my_sprite.name = "good guy"
  13.     direct = 0
  14.     shooting = 0
  15.     shoot_arm = 0
  16.  
  17.     left_bitmaps = bitmaps
  18.     right_bitmaps = new list
  19.     b = bitmaps loop n
  20.         b2 = copy b
  21.         flip FLIP_X bitmap b2
  22.         right_bitmaps add b2
  23.         bitmap b2 transparency 0,255,0
  24.  
  25. /////////////////////
  26. set_position: x,y
  27.     xpos = x
  28.     ypos = y
  29.  
  30. get_shot_position:
  31.     shoot_arm = !shoot_arm
  32.     shooting = TRUE
  33.     if direct then xoff = !shoot_arm * 50
  34.     else xoff = shoot_arm * 50 - 50
  35.     return xpos+xoff, ypos+32, 30*direct-15, 11
  36.  
  37. /////////////////////
  38. offset_position: xoff, yoff    // move the sprite
  39.     xpos = xpos + xoff
  40.     ypos = ypos + yoff
  41.     bound xpos, ypos window // confine sprite to window
  42.     if xoff > 0 then direct = 1
  43.     else direct = 0
  44.  
  45. //////////////////
  46. update_sprite:
  47.     // select the appropriate bitmap
  48.     //
  49.     if direct then bitmaps = right_bitmaps
  50.     else bitmaps = left_bitmaps
  51.     if shooting then index = 1 + shoot_arm
  52.     else index = 0
  53.     shooting = 0
  54.  
  55.     my_bitmap = bitmaps get index
  56.  
  57.     xmid = my_bitmap.xlen/2        // offset from center
  58.     ymid = my_bitmap.ylen/2
  59.  
  60.     sprite my_sprite bitmap my_bitmap at xpos-xmid, ypos-ymid depth ypos
  61.  
  62. ///////////////////////////////////
  63. ////////////////////////////
  64.  
  65.  
  66.